Return to start page

Core/Interface/Struct Player Selection.j

Code

		
1			library AStructCoreInterfacePlayerSelection requires optional ALibraryCoreDebugMisc
2
3 struct APlayerSelection
4 //start members
5 private player m_player
6 //members
7 private group m_group
8
9 //! runtextmacro optional A_STRUCT_DEBUG("\"APlayerSelection\"")
10
11 //start members
12
13 public method player takes nothing returns player
14 return this.m_player
15 endmethod
16
17 //members
18
19 public method group takes nothing returns group
20 return this.m_group
21 endmethod
22
23 //methods
24
25 public method save takes nothing returns nothing
26 debug call this.print("Saving player selection.")
27 call GroupClear(this.m_group)
28 call SyncSelections()
29 call GroupEnumUnitsSelected(this.m_group, this.m_player, null)
30 debug call this.print("Group size " + I2S(CountUnitsInGroup(this.m_group)))
31 endmethod
32
33 /// @todo Desync
34 public method restore takes nothing returns nothing
35 debug call this.print("Restoring for player " + GetPlayerName(this.m_player))
36 //call SelectGroupForPlayerBJ(this.m_group, this.m_player) /// @todo Desync
37 endmethod
38
39 public static method create takes player user returns thistype
40 local thistype this = thistype.allocate()
41 //start members
42 set this.m_player = user
43 //members
44 set this.m_group = CreateGroup()
45 return this
46 endmethod
47
48 public method onDestroy takes nothing returns nothing
49 //start members
50 set this.m_player = null
51 //members
52 call DestroyGroup(this.m_group)
53 set this.m_group = null
54 endmethod
55 endstruct
56
57 endlibrary